package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	mux := http.NewServeMux()
	mux.Handle("/", &myHandle{})
	mux.HandleFunc("/hello", sayWorld)
	mux.HandleFunc("/world", sayHello1)
	http.ListenAndServe(":8080", mux)
}

type myHandle struct {
}

func (this *myHandle) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	/*res, _ := M("db0").Select("id,title").From("article").Limit(10).GetAll()
	tt, _ := json.Marshal(res)*/
	io.WriteString(w, "url:"+r.URL.String())
}
func sayWorld(w http.ResponseWriter, r *http.Request) {
	io.WriteString(w, "heee")
}
func sayHello1(w http.ResponseWriter, r *http.Request) {
	name := r.Header.Get("name")
	fmt.Println("ok")
	io.WriteString(w, name)
}
